import Vue from "vue";
import VueI18n from "vue-i18n";
Vue.use(VueI18n);
import Cookie from "js-cookie";

// 导入语言包内容
import enLocale from "./lib/en";
import zhLocale from "./lib/zh";
// 导入element的语言包
import elementEnLocale from "element-ui/lib/locale/lang/en";
import elementZhLocale from "element-ui/lib/locale/lang/zh-CN";

// 实例化i18n对象
let i18n = new VueI18n({
  // 设置语言包类型
  locale: Cookie.get("language"),
  // 语言包信息
  messages: {
    zh: { ...zhLocale, ...elementZhLocale },
    en: { ...enLocale, ...elementEnLocale },
  },
});

// 暴露出去
export default i18n;
